home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / Menus.h < prev    next >
Text File  |  1991-04-17  |  6KB  |  189 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 9:31 PM
  4.     Menus.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __MENUS__
  15. #define __MENUS__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21.  
  22. enum {
  23.  
  24.  
  25. #define noMark '\0'         /*mark symbol for MarkItem*/
  26.  
  27. /* menu defProc messages */
  28.  
  29.     mDrawMsg = 0,
  30.     mChooseMsg = 1,
  31.     mSizeMsg = 2,
  32.     mDrawItemMsg = 4,
  33.     mCalcItemMsg = 5,
  34.     textMenuProc = 0,
  35.     hMenuCmd = 27,          /*itemCmd == 0x001B ==> hierarchical menu*/
  36.     hierMenu = -1,          /*a hierarchical menu - for InsertMenu call*/
  37.     mPopUpMsg = 3,          /*menu defProc messages - place yourself*/
  38.     mctAllItems = -98,      /*search for all Items for the given ID*/
  39.     mctLastIDIndic = -99    /*last color table entry has this in ID field*/
  40. };
  41.  
  42. struct MenuInfo {
  43.     short menuID;
  44.     short menuWidth;
  45.     short menuHeight;
  46.     Handle menuProc;
  47.     long enableFlags;
  48.     Str255 menuData;
  49. };
  50.  
  51. typedef struct MenuInfo MenuInfo;
  52. typedef MenuInfo *MenuPtr, **MenuHandle;
  53.  
  54. struct MCEntry {
  55.     short mctID;            /*menu ID.  ID = 0 is the menu bar*/
  56.     short mctItem;          /*menu Item. Item = 0 is a title*/
  57.     RGBColor mctRGB1;       /*usage depends on ID and Item*/
  58.     RGBColor mctRGB2;       /*usage depends on ID and Item*/
  59.     RGBColor mctRGB3;       /*usage depends on ID and Item*/
  60.     RGBColor mctRGB4;       /*usage depends on ID and Item*/
  61.     short mctReserved;      /*reserved for internal use*/
  62. };
  63.  
  64. typedef struct MCEntry MCEntry;
  65. typedef MCEntry *MCEntryPtr;
  66.  
  67.  
  68. /**/
  69.  
  70. typedef MCEntry MCTable[1], *MCTablePtr, **MCTableHandle;
  71.  
  72. struct MenuCRsrc {
  73.     short numEntries;       /*number of entries*/
  74.     MCTable mcEntryRecs;    /*ARRAY [1..numEntries] of MCEntry*/
  75. };
  76.  
  77. typedef struct MenuCRsrc MenuCRsrc;
  78. typedef MenuCRsrc *MenuCRsrcPtr, **MenuCRsrcHandle;
  79.  
  80.  
  81. #ifdef __cplusplus
  82. extern "C" {
  83. #endif
  84. pascal void InitMenus(void)
  85.     = 0xA930; 
  86. pascal MenuHandle NewMenu(short menuID,const Str255 menuTitle)
  87.     = 0xA931; 
  88. pascal MenuHandle GetMenu(short resourceID)
  89.     = 0xA9BF; 
  90. pascal void DisposeMenu(MenuHandle theMenu)
  91.     = 0xA932; 
  92. pascal void AppendMenu(MenuHandle menu,ConstStr255Param data)
  93.     = 0xA933; 
  94. pascal void AddResMenu(MenuHandle theMenu,ResType theType)
  95.     = 0xA94D; 
  96. pascal void InsertResMenu(MenuHandle theMenu,ResType theType,short afterItem)
  97.     = 0xA951; 
  98. pascal void InsertMenu(MenuHandle theMenu,short beforeID)
  99.     = 0xA935; 
  100. pascal void DrawMenuBar(void)
  101.     = 0xA937; 
  102. pascal void InvalMenuBar(void)
  103.     = 0xA81D; 
  104. pascal void DeleteMenu(short menuID)
  105.     = 0xA936; 
  106. pascal void ClearMenuBar(void)
  107.     = 0xA934; 
  108. pascal Handle GetNewMBar(short menuBarID)
  109.     = 0xA9C0; 
  110. pascal Handle GetMenuBar(void)
  111.     = 0xA93B; 
  112. pascal void SetMenuBar(Handle menuList)
  113.     = 0xA93C; 
  114. pascal void InsMenuItem(MenuHandle theMenu,ConstStr255Param itemString,
  115.     short afterItem)
  116.     = 0xA826; 
  117. pascal void DelMenuItem(MenuHandle theMenu,short item)
  118.     = 0xA952; 
  119. pascal long MenuKey(short ch)
  120.     = 0xA93E; 
  121. pascal void HiliteMenu(short menuID)
  122.     = 0xA938; 
  123. pascal void SetItem(MenuHandle theMenu,short item,ConstStr255Param itemString)
  124.     = 0xA947; 
  125. pascal void GetItem(MenuHandle theMenu,short item,Str255 itemString)
  126.     = 0xA946; 
  127. pascal void DisableItem(MenuHandle theMenu,short item)
  128.     = 0xA93A; 
  129. pascal void EnableItem(MenuHandle theMenu,short item)
  130.     = 0xA939; 
  131. pascal void CheckItem(MenuHandle theMenu,short item,Boolean checked)
  132.     = 0xA945; 
  133. pascal void SetItemMark(MenuHandle theMenu,short item,short markChar)
  134.     = 0xA944; 
  135. pascal void GetItemMark(MenuHandle theMenu,short item,short *markChar)
  136.     = 0xA943; 
  137. pascal void SetItemIcon(MenuHandle theMenu,short item,short iconIndex)
  138.     = 0xA940; 
  139. pascal void GetItemIcon(MenuHandle theMenu,short item,short *iconIndex)
  140.     = 0xA93F; 
  141. pascal void SetItemStyle(MenuHandle theMenu,short item,short chStyle)
  142.     = 0xA942; 
  143. pascal void GetItemStyle(MenuHandle theMenu,short item,Style *chStyle); 
  144. pascal void CalcMenuSize(MenuHandle theMenu)
  145.     = 0xA948; 
  146. pascal short CountMItems(MenuHandle theMenu)
  147.     = 0xA950; 
  148. pascal MenuHandle GetMHandle(short menuID)
  149.     = 0xA949; 
  150. pascal void FlashMenuBar(short menuID)
  151.     = 0xA94C; 
  152. pascal void SetMenuFlash(short count)
  153.     = 0xA94A; 
  154. pascal long MenuSelect(Point startPt)
  155.     = 0xA93D; 
  156. pascal void InitProcMenu(short resID)
  157.     = 0xA808; 
  158. pascal void GetItemCmd(MenuHandle theMenu,short item,short *cmdChar)
  159.     = 0xA84E; 
  160. pascal void SetItemCmd(MenuHandle theMenu,short item,short cmdChar)
  161.     = 0xA84F; 
  162. pascal long PopUpMenuSelect(MenuHandle menu,short top,short left,short popUpItem)
  163.     = 0xA80B; 
  164. pascal long MenuChoice(void)
  165.     = 0xAA66; 
  166. pascal void DelMCEntries(short menuID,short menuItem)
  167.     = 0xAA60; 
  168. pascal MCTableHandle GetMCInfo(void)
  169.     = 0xAA61; 
  170. pascal void SetMCInfo(MCTableHandle menuCTbl)
  171.     = 0xAA62; 
  172. pascal void DispMCInfo(MCTableHandle menuCTbl)
  173.     = 0xAA63; 
  174. pascal MCEntryPtr GetMCEntry(short menuID,short menuItem)
  175.     = 0xAA64; 
  176. pascal void SetMCEntries(short numEntries,MCTablePtr menuCEntries)
  177.     = 0xAA65; 
  178. MenuHandle newmenu(short menuID,char *menuTitle); 
  179. void getitem(MenuHandle menu,short item,char *itemString); 
  180. void appendmenu(MenuHandle menu,char *data); 
  181. void insmenuitem(MenuHandle theMenu,char *itemString,short afterItem); 
  182. long menuselect(Point *startPt); 
  183. void setitem(MenuHandle menu,short item,char *itemString); 
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187.  
  188. #endif
  189.